home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGSCAL
/
TBUTIL2.LZH
/
DECBIN.INC
< prev
next >
Wrap
Text File
|
1984-07-13
|
653b
|
23 lines
PROCEDURE DecBin(VAR DecInt:INTEGER;VAR Bin:Btype);
{ This procedure converts an integer (DecInt) into a binary number
{ that is stored in a character array (Bin) which is 17 characters long.
{ The bits are stored with the LSB in Bin[17].
{ Danny Cavasos June 1984 }
CONST
Divisor : INTEGER = 2;
VAR
Result,Remainder,i : INTEGER;
Temp : STRING[1];
BEGIN
FOR i:=1 TO 17 DO Bin[i]:=' ';
i:=18;
REPEAT
Result := DecInt DIV Divisor;
Remainder := DecInt MOD Divisor;
i:=i-1;
STR(Remainder:1,Temp);
Bin[i]:=Temp;
DecInt:=Result;
UNTIL (Result=0) AND (Remainder=0);
END;